package com.ying.po.system;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户对象
 * @author Java助手
 * @date 2021/12/04 20:13
 */
@ApiModel("用户对象")
@Entity
@Table(name= "t_user")
@DynamicInsert
@DynamicUpdate
public class User implements Serializable {

    @ApiModelProperty(value = "主键", example = "1")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    private Integer id;

    @ApiModelProperty("用户名")
    @Column(name = "USERNAME")
    private String username;

    @ApiModelProperty("密码")
    @Column(name = "PASSWORD")
    private String password;

    @ApiModelProperty("昵称")
    @Column(name = "NICKNAME")
    private String nickname;

    @ApiModelProperty("生日")
    @Column(name = "BIRTHDAY")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
    private Date birthday;

    @ApiModelProperty(value = "性别", example = "1")
    @Column(name = "SEX")
    private Integer sex;

    @ApiModelProperty("邮箱")
    @Column(name = "EMAIL")
    private String email;

    @ApiModelProperty("手机号码")
    @Column(name = "MOBILE")
    private String mobile;

    @ApiModelProperty("创建时间")
    @Column(name = "CREATE_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @Column(name = "UPDATE_TIME")
    private Date updateTime;

    @ApiModelProperty("是否删除，1是，0否")
    @Column(name = "IS_DELETE")
    private Boolean isDelete;

    @ApiModelProperty("用户状态，1正常，0禁用")
    @Column(name = "STATUS")
    private Integer status;

    @ApiModelProperty("头像地址")
    @Column(name = "AVATAR")
    private String avatar;

    @ApiModelProperty("用户类型，1管理员，0普通用户")
    @Column(name = "TYPE")
    private Integer type;

    @ApiModelProperty("用户登录来源")
    @Column(name = "SOURCE")
    private String source;

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Boolean isDelete) {
        this.isDelete = isDelete;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", birthday=" + birthday +
                ", sex=" + sex +
                ", email='" + email + '\'' +
                ", mobile='" + mobile + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isDelete=" + isDelete +
                ", status=" + status +
                ", avatar='" + avatar + '\'' +
                ", type=" + type +
                ", source='" + source + '\'' +
                '}';
    }
}
